package com.sailorj.util;

import java.util.Random;

/**
 * @program: springLab
 * @description:
 * @author: Huang_shengjun
 * @create: 2020-06-28 12:38
 **/
public class NumUtil {

    /**
     * 获取count个随机数
     * @param count 随机数个数
     * @return
     */
    public static String getNum(int count){
        StringBuffer sb = new StringBuffer();
        String str = "0123456789";
        Random r = new Random();
        for(int i=0;i<count;i++){
            int num = r.nextInt(str.length());
            sb.append(str.charAt(num));
            str = str.replace((str.charAt(num)+""), "");
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(getNum(4));
    }
}
